package scalaLearning.part6

import scala.collection.mutable.ListBuffer

object ComparatorDemo1 {
  def main(args: Array[String]): Unit = {
    val list = new ListBuffer[Student2]()
    val t1 = new Student2("tom",88)
    val t2 = new Student2("jom",98)
    val t3 = new Student2("som",48)
    val t4 = new Student2("rom",38)
    list+=t1
    list+=t2
    list+=t3
    list+=t4
    val res = list.sortBy(-_.score)
    println(res)

  }
}

case class Student2(val name:String,val score:Int)

